# Introduction

Upgrading from 3.0 to 3.1 should work fine with no changes, but you will see deprecation warnings which can be silenced by adding two new lines to `config/initializers/formtastic.rb` (or re-generating it). These new configurations are related to the new namespaced custom inputs (and actions) added in 3.1.

# Upgrading your initializer to support namespaced custom inputs (and actions)

Open your `config/initializers/formtastic.rb` and add these two lines:

```ruby
Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
```

This will be default in Formtastic 4.0. Assuming you haven't modified `input_class(as)`, `custom_input_class_name(as)`, `standard_input_class_name(as)` and their relevant counterparts for `action` everything should work as before.

You can also consider re-generating the initializer and reviewing the diff

```
$ rails generate formtastic:install
$ git diff
$ # review what's changed
$ git commit -am "update formtastic initializer"
```

# More information on namespaced input & action class finders

Formtastic used to constantize class of inputs in `Formtastic::FormBuilder#input_class(as)` while getting the right name from `custom_input_class_name(as)` or `standard_input_class_name(as)`. It worked the same way for actions, but just calling different methods.

Now however, Formtastic::FormBuilder has two settings: `input_class_finder` and `input_namespaces`.
How the input/action lookup works now is following: instantiate class finder with input namespaces, and ask it for the constant. [Class finder](http://www.rubydoc.info/github/justinfrench/formtastic/Formtastic/NamespacedClassFinder) then generates the correct name for input/action and tries to find that constant in defined namespaces.

The `Formtastic::FormBuilder.(input|action)_namespaces` setting is just an array. By default for inputs it is `[::Object, ::Formtastic::Inputs]` and for actions `[::Object, ::Formtastic::Actions]`. If you need to add another scope, just add it to the array to correct position.

If you want to change the name of the class, you need to create [own class finder](http://www.rubydoc.info/github/justinfrench/formtastic/Formtastic/NamespacedClassFinder) and set it to `Formtastic::FormBuilder.(input|action)_class_finder`. Check how [InputClassFinder](http://www.rubydoc.info/github/justinfrench/formtastic/Formtastic/InputClassFinder) and [ActionClassFinder](http://www.rubydoc.info/github/justinfrench/formtastic/Formtastic/ActionClassFinder) are implemented.